package com.woniuxy.propertyjava.service.impl;

import com.woniuxy.propertyjava.dao.RegisteredDao;
import com.woniuxy.propertyjava.entity.PageBean;
import com.woniuxy.propertyjava.entity.Registered;
import com.woniuxy.propertyjava.service.RegisteredService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
@Service
public class RegisteredServiceImpl implements RegisteredService {

    @Resource
    RegisteredDao registeredDao;

    //根据id查询数据
    @Override
    public Registered getqueryById(Integer rid) {
        return this.registeredDao.queryById(rid);
    }

    //分页查询
    @Override
    public PageBean<Registered> getAllRegisteredById(Registered registered,int pageIndex, int pageSize) {
        PageBean<Registered> pageBean=new PageBean<>();
        pageBean.setBeanList(registeredDao.queryAllRegisteredById(registered,pageIndex,pageSize));
        pageBean.setPageIndex(pageIndex);
        pageBean.setPageSize(pageSize);
        pageBean.setTotalRecode(registeredDao.count());
        return pageBean;
    }

    //添加
    @Override
    public void getinsert(Registered registered) {
        registeredDao.insert(registered);
    }

    //删除
    @Override
    public void getdeleteById(Integer rid) {
        registeredDao.deleteById(rid);
    }

    //修改
    @Override
    public void getupdate(Registered registered) {
        registeredDao.update(registered);
    }

}
